package com.example.demo.src;

/**
 * Created by Easettle
 *
 * @date 2021/6/6
 * Content:
 */
public class AppContext {

    public static final UserState LOGIN_STATE = new LonginInState();
    public static final UserState UNLOGIN_STATE = new UnLonginState();
    private UserState currentStates = UNLOGIN_STATE;

    {
        LOGIN_STATE.setContext(this);
        UNLOGIN_STATE.setContext(this);
    }

    public void setStates(UserState userState) {
        this.currentStates = userState;
        this.currentStates.setContext(this);
    }

    public UserState getStates() {
        return this.currentStates;
    }

    public void favorite() {
        this.currentStates.favorite();
    }

    public void comment(String comment) {
        this.currentStates.comment(comment);
    }
}
